home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 4 / Macwelt DVD 4.cdr / Entwickler / Mac-OS / oxygen / samples / docbook / xsl / html / component.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-09  |  13.3 KB  |  376 lines  |  [□□□□/□□□□]

  1. component.xsl2§π¢tÚπ¢tÚÅÅhz<?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.                 version='1.0'>
  4.  
  5. <!-- ********************************************************************
  6.      $Id: component.xsl,v 1.1 2002/05/29 09:55:49 dan Exp $
  7.      ********************************************************************
  8.  
  9.      This file is part of the XSL DocBook Stylesheet distribution.
  10.      See ../README or http://nwalsh.com/docbook/xsl/ for copyright
  11.      and other information.
  12.  
  13.      ******************************************************************** -->
  14.  
  15. <!-- ==================================================================== -->
  16.  
  17. <xsl:template name="component.title">
  18.   <xsl:param name="node" select="."/>
  19.   <h2 class="title">
  20.     <xsl:call-template name="anchor">
  21.       <xsl:with-param name="node" select="$node"/>
  22.       <xsl:with-param name="conditional" select="0"/>
  23.     </xsl:call-template>
  24.     <xsl:apply-templates select="$node" mode="object.title.markup">
  25.       <xsl:with-param name="allow-anchors" select="1"/>
  26.     </xsl:apply-templates>
  27.   </h2>
  28. </xsl:template>
  29.  
  30. <xsl:template name="component.subtitle">
  31.   <xsl:param name="node" select="."/>
  32.   <xsl:variable name="subtitle"
  33.                 select="($node/docinfo/subtitle
  34.                         |$node/prefaceinfo/subtitle
  35.                         |$node/chapterinfo/subtitle
  36.                         |$node/appendixinfo/subtitle
  37.                         |$node/articleinfo/subtitle
  38.                         |$node/artheader/subtitle
  39.                         |$node/subtitle)[1]"/>
  40.  
  41.   <xsl:if test="$subtitle">
  42.     <h3 class="subtitle">
  43.       <i>
  44.         <xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
  45.       </i>
  46.     </h3>
  47.   </xsl:if>
  48. </xsl:template>
  49.  
  50. <xsl:template name="component.separator">
  51. </xsl:template>
  52.  
  53. <!-- ==================================================================== -->
  54.  
  55. <xsl:template match="dedication" mode="dedication">
  56.   <div class="{name(.)}">
  57.     <xsl:call-template name="dedication.titlepage"/>
  58.     <xsl:apply-templates/>
  59.     <xsl:call-template name="process.footnotes"/>
  60.   </div>
  61. </xsl:template>
  62.  
  63. <xsl:template match="dedication/title" mode="titlepage.mode" priority="2">
  64.   <xsl:call-template name="component.title">
  65.     <xsl:with-param name="node" select="ancestor::dedication[1]"/>
  66.   </xsl:call-template>
  67. </xsl:template>
  68.  
  69. <xsl:template match="dedication/subtitle" mode="titlepage.mode" priority="2">
  70.   <xsl:call-template name="component.subtitle">
  71.     <xsl:with-param name="node" select="ancestor::dedication[1]"/>
  72.   </xsl:call-template>
  73. </xsl:template>
  74.  
  75. <xsl:template match="dedication"></xsl:template> <!-- see mode="dedication" -->
  76. <xsl:template match="dedication/title"></xsl:template>
  77. <xsl:template match="dedication/subtitle"></xsl:template>
  78. <xsl:template match="dedication/titleabbrev"></xsl:template>
  79.  
  80. <!-- ==================================================================== -->
  81.  
  82. <xsl:template match="colophon">
  83.   <div class="{name(.)}">
  84.     <xsl:if test="$generate.id.attributes != 0">
  85.       <xsl:attribute name="id">
  86.         <xsl:call-template name="object.id"/>
  87.       </xsl:attribute>
  88.     </xsl:if>
  89.  
  90.     <xsl:call-template name="component.separator"/>
  91.     <xsl:call-template name="component.title"/>
  92.     <xsl:call-template name="component.subtitle"/>
  93.  
  94.     <xsl:apply-templates/>
  95.     <xsl:call-template name="process.footnotes"/>
  96.   </div>
  97. </xsl:template>
  98.  
  99. <xsl:template match="colophon/title"></xsl:template>
  100.  
  101. <!-- ==================================================================== -->
  102.  
  103. <xsl:template match="preface">
  104.   <div class="{name(.)}">
  105.     <xsl:if test="$generate.id.attributes != 0">
  106.       <xsl:attribute name="id">
  107.         <xsl:call-template name="object.id"/>
  108.       </xsl:attribute>
  109.     </xsl:if>
  110.  
  111.     <xsl:call-template name="component.separator"/>
  112.     <xsl:call-template name="preface.titlepage"/>
  113.  
  114.     <xsl:variable name="toc.params">
  115.       <xsl:call-template name="find.path.params">
  116.         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  117.       </xsl:call-template>
  118.     </xsl:variable>
  119.  
  120.     <xsl:if test="contains($toc.params, 'toc')">
  121.       <xsl:call-template name="component.toc"/>
  122.     </xsl:if>
  123.     <xsl:apply-templates/>
  124.     <xsl:call-template name="process.footnotes"/>
  125.   </div>
  126. </xsl:template>
  127.  
  128. <xsl:template match="preface/title" mode="titlepage.mode" priority="2">
  129.   <xsl:call-template name="component.title">
  130.     <xsl:with-param name="node" select="ancestor::preface[1]"/>
  131.   </xsl:call-template>
  132. </xsl:template>
  133.  
  134. <xsl:template match="preface/subtitle
  135.                      |preface/prefaceinfo/subtitle
  136.                      |preface/docinfo/subtitle"
  137.               mode="titlepage.mode" priority="2">
  138.   <xsl:call-template name="component.subtitle">
  139.     <xsl:with-param name="node" select="ancestor::preface[1]"/>
  140.   </xsl:call-template>
  141. </xsl:template>
  142.  
  143. <xsl:template match="preface/docinfo|prefaceinfo"></xsl:template>
  144. <xsl:template match="preface/title"></xsl:template>
  145. <xsl:template match="preface/titleabbrev"></xsl:template>
  146. <xsl:template match="preface/subtitle"></xsl:template>
  147.  
  148. <!-- ==================================================================== -->
  149.  
  150. <xsl:template match="chapter">
  151.   <div class="{name(.)}">
  152.     <xsl:if test="$generate.id.attributes != 0">
  153.       <xsl:attribute name="id">
  154.         <xsl:call-template name="object.id"/>
  155.       </xsl:attribute>
  156.     </xsl:if>
  157.  
  158.     <xsl:call-template name="component.separator"/>
  159.     <xsl:call-template name="chapter.titlepage"/>
  160.  
  161.     <xsl:variable name="toc.params">
  162.       <xsl:call-template name="find.path.params">
  163.         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  164.       </xsl:call-template>
  165.     </xsl:variable>
  166.     <xsl:if test="contains($toc.params, 'toc')">
  167.       <xsl:call-template name="component.toc"/>
  168.     </xsl:if>
  169.     <xsl:apply-templates/>
  170.     <xsl:call-template name="process.footnotes"/>
  171.   </div>
  172. </xsl:template>
  173.  
  174. <xsl:template match="chapter/title" mode="titlepage.mode" priority="2">
  175.   <xsl:call-template name="component.title">
  176.     <xsl:with-param name="node" select="ancestor::chapter[1]"/>
  177.   </xsl:call-template>
  178. </xsl:template>
  179.  
  180. <xsl:template match="chapter/subtitle
  181.                      |chapter/chapterinfo/subtitle
  182.                      |chapter/docinfo/subtitle"
  183.               mode="titlepage.mode" priority="2">
  184.   <xsl:call-template name="component.subtitle">
  185.     <xsl:with-param name="node" select="ancestor::chapter[1]"/>
  186.   </xsl:call-template>
  187. </xsl:template>
  188.  
  189. <xsl:template match="chapter/docinfo|chapterinfo"></xsl:template>
  190. <xsl:template match="chapter/title"></xsl:template>
  191. <xsl:template match="chapter/titleabbrev"></xsl:template>
  192. <xsl:template match="chapter/subtitle"></xsl:template>
  193.  
  194. <!-- ==================================================================== -->
  195.  
  196. <xsl:template match="appendix">
  197.   <div class="{name(.)}">
  198.     <xsl:if test="$generate.id.attributes != 0">
  199.       <xsl:attribute name="id">
  200.         <xsl:call-template name="object.id"/>
  201.       </xsl:attribute>
  202.     </xsl:if>
  203.  
  204.     <xsl:call-template name="component.separator"/>
  205.     <xsl:call-template name="appendix.titlepage"/>
  206.  
  207.     <xsl:variable name="toc.params">
  208.       <xsl:call-template name="find.path.params">
  209.         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  210.       </xsl:call-template>
  211.     </xsl:variable>
  212.     <xsl:if test="contains($toc.params, 'toc')">
  213.       <xsl:call-template name="component.toc"/>
  214.     </xsl:if>
  215.     <xsl:apply-templates/>
  216.     <xsl:call-template name="process.footnotes"/>
  217.   </div>
  218. </xsl:template>
  219.  
  220. <xsl:template match="article/appendix">
  221.   <div class="{name(.)}">
  222.     <xsl:if test="$generate.id.attributes != 0">
  223.       <xsl:attribute name="id">
  224.         <xsl:call-template name="object.id"/>
  225.       </xsl:attribute>
  226.     </xsl:if>
  227.  
  228.     <xsl:call-template name="section.heading">
  229.       <xsl:with-param name="level" select="2"/>
  230.       <xsl:with-param name="title">
  231.         <xsl:apply-templates select="." mode="object.title.markup"/>
  232.       </xsl:with-param>
  233.     </xsl:call-template>
  234.  
  235.     <xsl:apply-templates/>
  236.   </div>
  237. </xsl:template>
  238.  
  239. <xsl:template match="appendix/title" mode="titlepage.mode" priority="2">
  240.   <xsl:call-template name="component.title">
  241.     <xsl:with-param name="node" select="ancestor::appendix[1]"/>
  242.   </xsl:call-template>
  243. </xsl:template>
  244.  
  245. <xsl:template match="appendix/subtitle
  246.                      |appendix/appendixinfo/subtitle
  247.                      |appendix/docinfo/subtitle"
  248.               mode="titlepage.mode" priority="2">
  249.   <xsl:call-template name="component.subtitle">
  250.     <xsl:with-param name="node" select="ancestor::appendix[1]"/>
  251.   </xsl:call-template>
  252. </xsl:template>
  253.  
  254. <xsl:template match="appendix/docinfo|appendixinfo"></xsl:template>
  255. <xsl:template match="appendix/title"></xsl:template>
  256. <xsl:template match="appendix/titleabbrev"></xsl:template>
  257. <xsl:template match="appendix/subtitle"></xsl:template>
  258.  
  259. <!-- ==================================================================== -->
  260.  
  261. <xsl:template match="dedication" mode="component.number">
  262.   <xsl:param name="add.space" select="false()"/>
  263. </xsl:template>
  264.  
  265. <xsl:template match="preface" mode="component.number">
  266.   <xsl:param name="add.space" select="false()"/>
  267. </xsl:template>
  268.  
  269. <xsl:template match="chapter" mode="component.number">
  270.   <xsl:param name="add.space" select="false()"/>
  271.  
  272.   <xsl:choose>
  273.     <xsl:when test="@label">
  274.       <xsl:value-of select="@label"/>
  275.       <xsl:text>.</xsl:text>
  276.       <xsl:if test="$add.space">
  277.         <xsl:call-template name="gentext.space"/>
  278.       </xsl:if>
  279.     </xsl:when>
  280.     <xsl:when test="$chapter.autolabel">
  281.       <xsl:number from="book" count="chapter" format="1."/>
  282.       <xsl:if test="$add.space">
  283.         <xsl:call-template name="gentext.space"/>
  284.       </xsl:if>
  285.     </xsl:when>
  286.     <xsl:otherwise></xsl:otherwise>
  287.   </xsl:choose>
  288. </xsl:template>
  289.  
  290. <xsl:template match="appendix" mode="component.number">
  291.   <xsl:param name="add.space" select="false()"/>
  292.  
  293.   <xsl:choose>
  294.     <xsl:when test="@label">
  295.       <xsl:value-of select="@label"/>
  296.       <xsl:text>.</xsl:text>
  297.       <xsl:if test="$add.space">
  298.         <xsl:call-template name="gentext.space"/>
  299.       </xsl:if>
  300.     </xsl:when>
  301.     <xsl:when test="$chapter.autolabel">
  302.       <xsl:number from="book" count="appendix" format="A."/>
  303.       <xsl:if test="$add.space">
  304.         <xsl:call-template name="gentext.space"/>
  305.       </xsl:if>
  306.     </xsl:when>
  307.     <xsl:otherwise></xsl:otherwise>
  308.   </xsl:choose>
  309. </xsl:template>
  310.  
  311. <xsl:template match="article" mode="component.number">
  312.   <xsl:param name="add.space" select="false()"/>
  313. </xsl:template>
  314.  
  315. <xsl:template match="bibliography" mode="component.number">
  316.   <xsl:param name="add.space" select="false()"/>
  317. </xsl:template>
  318.  
  319. <xsl:template match="glossary" mode="component.number">
  320.   <xsl:param name="add.space" select="false()"/>
  321. </xsl:template>
  322.  
  323. <xsl:template match="index" mode="component.number">
  324.   <xsl:param name="add.space" select="false()"/>
  325. </xsl:template>
  326.  
  327. <!-- ==================================================================== -->
  328.  
  329. <xsl:template match="article">
  330.   <div class="{name(.)}">
  331.     <xsl:if test="$generate.id.attributes != 0">
  332.       <xsl:attribute name="id">
  333.         <xsl:call-template name="object.id"/>
  334.       </xsl:attribute>
  335.     </xsl:if>
  336.  
  337.     <xsl:call-template name="article.titlepage"/>
  338.  
  339.     <xsl:variable name="toc.params">
  340.       <xsl:call-template name="find.path.params">
  341.         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  342.       </xsl:call-template>
  343.     </xsl:variable>
  344.     <xsl:if test="contains($toc.params, 'toc')">
  345.       <xsl:call-template name="component.toc"/>
  346.     </xsl:if>
  347.     <xsl:apply-templates/>
  348.     <xsl:call-template name="process.footnotes"/>
  349.   </div>
  350. </xsl:template>
  351.  
  352. <xsl:template match="article/title" mode="titlepage.mode" priority="2">
  353.   <xsl:call-template name="component.title">
  354.     <xsl:with-param name="node" select="ancestor::article[1]"/>
  355.   </xsl:call-template>
  356. </xsl:template>
  357.  
  358. <xsl:template match="article/subtitle
  359.                      |article/articleinfo/subtitle
  360.                      |article/artheader/subtitle"
  361.               mode="titlepage.mode" priority="2">
  362.   <xsl:call-template name="component.subtitle">
  363.     <xsl:with-param name="node" select="ancestor::article[1]"/>
  364.   </xsl:call-template>
  365. </xsl:template>
  366.  
  367. <xsl:template match="article/artheader|article/articleinfo"></xsl:template>
  368. <xsl:template match="article/title"></xsl:template>
  369. <xsl:template match="article/titleabbrev"></xsl:template>
  370. <xsl:template match="article/subtitle"></xsl:template>
  371.  
  372. <!-- ==================================================================== -->
  373.  
  374. </xsl:stylesheet>
  375.  
  376. This resource fork intentionally left blank   ˇˇ